package flatlandRPGTest;

import org.lwjgl.util.vector.Vector2f;
import flatlandRPG.Entity;
import student.*;

// -------------------------------------------------------------------------
/**
 * Tests the methods of the Entity class.
 *
 * @author evant
 * @version Apr 15, 2011
 */
public abstract class AbstractEntityTest
    extends TestCase
{
    private Entity testEntity;


    // ----------------------------------------------------------
    /**
     * Returns a concrete Entity.
     *
     * @return a concrete Entity
     */
    public abstract Entity getEntity();


    /**
     * Sets up the test case. This is called before each test method.
     */
    public void setUp()
    {
        testEntity = getEntity();
    }


    // ----------------------------------------------------------
    /**
     * Tests that location is set properly.
     */
    public void testLocation()
    {
        testEntity.setLocation(new Vector2f(1, 2));
        Vector2f location = testEntity.getLocation();
        assertEquals(1, location.getX(), 0.0001);
        assertEquals(2, location.getY(), 0.0001);
    }

    // ----------------------------------------------------------
    /**
     * Tests that the x position is set properly.
     */
    public void testX()
    {
        testEntity.setX(1);
        assertEquals(1, testEntity.getX(), 0.0001);
    }

    // ----------------------------------------------------------
    /**
     * Tests that the y position is set properly.
     */
    public void testY()
    {
        testEntity.setY(1);
        assertEquals(1, testEntity.getY(), 0.0001);
    }
}
